package com.sh.tgtools.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author: ShiHao
 * @description:
 * @date: 2019/12/26  14:17
 */

public class GuidePageAdapter extends FragmentPagerAdapter {

    private List<Fragment> fragments = new ArrayList<Fragment>();
//    private Context context;

    public GuidePageAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int position) {
        return fragments.get(position);
    }

    public void addItem(Fragment fragment) {
        fragments.add(fragment);
    }


    public void setFragmentList(/*Context context,*/ List<Fragment> fragmentList){
//        this.context = context;
        this.fragments = fragmentList;
    }

    @Override
    public int getCount() {
        return fragments.size();
    }
}
